package org.hiucung.orangeaivoiceapp.adapter

import org.hiucung.lib_base.base.adapter.CommonAdapter
import org.hiucung.lib_base.base.adapter.CommonViewHolder
import org.hiucung.orangeaivoiceapp.R
import org.hiucung.orangeaivoiceapp.data.ChatList
import org.hiucung.orangeaivoiceapp.entity.AppConstants

/**
 * @title: ChatListAdapter
 * @projectName OrangeAiVoiceApp
 * @description: 对话列表适配器
 * @author Kicc
 * @date 2021/11/29 16:20
 */
class ChatListAdapter(
    mList: List<ChatList>,
) : CommonAdapter<ChatList>(mList, object : OnMoreBindDataListener<ChatList> {

    override fun onBindViewHolder(
        model: ChatList,
        viewHolder: CommonViewHolder,
        type: Int,
        position: Int
    ) {
        when(type){
            AppConstants.TYPE_MINE_TEXT -> viewHolder.setText(R.id.tv_mine_text,model.text)
            AppConstants.TYPE_AI_TEXT -> viewHolder.setText(R.id.tv_ai_text,model.text)

        }
    }

    override fun getLayoutId(type: Int): Int {
        return when(type){
            AppConstants.TYPE_MINE_TEXT -> R.layout.layout_mine_text
            AppConstants.TYPE_AI_TEXT -> R.layout.layout_ai_text
            AppConstants.TYPE_AI_WEATHER -> R.layout.layout_ai_weather_text
            else -> 0
        }
    }

    override fun getItemType(position: Int): Int {
        return mList[position].type
    }

}) {


}